<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    body{
        background-color: chocolate;
    }
    .aside{
        margin-right: -200px;
        position: absolute;
        right: 0;
        top: 0;
        width: 200px;
        height: 100vh;
        background-color: red;
        transition: ease 0.5s all;
    }
    .toggleClass{
        margin-right:0px;
    }
</style>
<body>
   <div id="app">
       <div>{{flag}}</div>
        <button class="btn" v-on:click="toggle">按钮</button>
        <div v-bind:class="{aside:true,toggleClass:isflag}"></div>
   </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        let vm = new Vue({
            el:'#app',
            data:{
                isflag:true,
            },
            methods:{
                toggle(){
                    this.isflag = !this.isflag;
                }
            }

        })
    </script>
    
</body>
</html>